package com.shujia.control;

import com.shujia.pojo.Dept;
import com.shujia.service.CacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "cache")
public class CacheController {

    @Autowired
    CacheService cacheService;


    @RequestMapping(value = "getData")
    public String getData(){
        System.out.println("*******************");
        return cacheService.getData();
    }


    @RequestMapping(value = "/get/{deptno}",method = RequestMethod.GET)
    public Dept getCusBaseInfoById(@PathVariable("deptno") Integer deptno){
        System.out.println("该方法被调用...");
        return cacheService.getDeptByNo(deptno);
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public String updateInfo(@RequestBody Dept dept){
        return cacheService.updateInfo(dept);
    }

}
